package applet.attendee.unlocked;

import java.awt.BorderLayout;
import java.awt.Component;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.border.BevelBorder;

import applet.attendee.CMSAttendeeView;
import applet.attendee.unlocked.components.events.CMSAttendeeEventsView;
import applet.attendee.unlocked.components.lodgings.CMSAttendeeLodgingsView;
import applet.attendee.unlocked.components.summary.CMSAttendeeSummaryView;
import applet.attendee.unlocked.components.travel.CMSAttendeeTravelView;
import applet.view.BaseCMSView;

public class CMSAttendeeUnlockedView extends BaseCMSView
{
	private CMSAttendeeView attendeeView;
	public CMSAttendeeView attendeeView() { return attendeeView; }
	
	public CMSAttendeeUnlockedView(CMSAttendeeView attendeeView)
	{
		this.attendeeView = attendeeView;
		
		JPanel view = new JPanel(new BorderLayout());
		view.setBorder(new BevelBorder(BevelBorder.LOWERED));
			JTabbedPane tabs = new JTabbedPane();
			tabs.addTab("Summary", wrapInScrollPane(new CMSAttendeeSummaryView(attendeeView)));
			tabs.addTab("Events", wrapInScrollPane(new CMSAttendeeEventsView(attendeeView)));
			tabs.addTab("Lodgings", wrapInScrollPane(new CMSAttendeeLodgingsView(attendeeView)));
			tabs.addTab("Travel", wrapInScrollPane(new CMSAttendeeTravelView(attendeeView)));
			
		view.add(tabs, BorderLayout.CENTER);
		
		setView(view);
	}
	
	private JScrollPane wrapInScrollPane(Component component)
	{
		return new JScrollPane(component, 
				JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
				JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	}
}